package tech.yqyl.solo.processor;

import lombok.Data;
import tech.yqyl.YamlUtils;

/**
 * @className: ProcessorConfig
 * @description:
 * @author: caoyangjie
 * @date: 2024/9/4
 **/
@Data
public class MetaConfig {
    // 是否为 写本地文件, 如果是 true 代表写本地文件, false 代表写 Halo 博客
    boolean writeFile = true;
    boolean copyRight = false;

    public static MetaConfig sourceConfig(){
        MetaConfig config = new MetaConfig();
        config.setWriteFile(true);
        config.setCopyRight(false);
        return config;
    }

    public static MetaConfig toHaloNoRightConfig(){
        MetaConfig config = new MetaConfig();
        config.setWriteFile(false);
        config.setCopyRight(false);
        return config;
    }

    public static MetaConfig toHaloHasRightConfig(){
        MetaConfig config = new MetaConfig();
        config.setCopyRight(true);
        config.setWriteFile(false);
        return config;
    }

    public static MetaConfig getFromConfig(){
        MetaConfig config = new MetaConfig();
        config.setCopyRight(YamlUtils.getConfig().getHalo().getMetaConfig().isCopyRight());
        config.setWriteFile(YamlUtils.getConfig().getHalo().getMetaConfig().isWriteFile());
        return config;
    }
}
